function scanCode() {
    return new Promise((resolve, reject) => {
        wx.scanCode({
            success: (res) => {
                /*res = {
                    charSet: "UTF-8",
                    errMsg: "scanCode:ok",
                    result: "9787543464582",
                    scanType: "EAN_13"
                };*/
                resolve(res.result);
            },
            fail: (err) => {
                wx.showToast({
                    title: '扫码失败，请重试',
                    icon: 'none',
                    duration: 3000
                });
                reject(err);
            }
        });
    })
}

module.exports = scanCode;